﻿<Page x:Class="ListPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:n="http://wpfglue.wordpress.com/navigation"
    xmlns:t="clr-namespace:NavigationExample"
    Title="ListPage">
    <DockPanel>
        <WrapPanel DockPanel.Dock="Bottom">
            <Button x:Name="AddButton" Click="AddButton_Click">Add Item</Button>
            <Button x:Name="DeleteButton" Click="DeleteButton_Click">Delete Item</Button>
            <Button x:Name="EditButton" 
               DataContext="{Binding ElementName=ItemListView, Path=SelectedItem}" 
               Command="GoToPage" CommandParameter="{Binding}" 
               n:Navigation.Uri="DetailPage.xaml">
                <Button.Style>
                    <Style TargetType="Button">
                        <Style.Triggers>
                            <Trigger Property="DataContext" Value="{x:Null}">
                                <Setter Property="n:Navigation.CanNavigate" Value="False"/>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
                <TextBlock Text="{Binding Path=Name, TargetNullValue='Edit [New Customer]', FallbackValue='[No Customer Selected]', StringFormat='Edit {0}'}"/>
            </Button>
      <Button x:Name="GCButton" Click="GCButton_Click">GC</Button>
    </WrapPanel>
        <ListView x:Name="ItemListView" ItemsSource="{StaticResource customerList}"/>
    </DockPanel>
</Page>
